#include <stdio.h>

void insertSort(int* array, int length)
{
    int i, j;
    int temp;
    for(i = 0; i < length; ++i) {
	temp = array[i];
	j = i - 1;
	while(j >= 0 && temp > array[j]) {
	    array[j + 1] = array[j];
	    j--;
	}
	array[j + 1] = temp;
    }
}
